<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            let shu = Number(parseInt(Math.random() * (50 - 1 + 1) + 1));
            console.log(shu);
            for (let i = 1; i <= 5; ++i) {
                let x = Number(parseInt(window.prompt("请输入你猜的数字！")));
                if (x === shu) {
                    alert("聪明");
                    break;
                } else if (x > shu) {
                    alert("大了");
                } else if (x < shu) {
                    alert("小了");
                }
            }
            alert("结束了哦！");
        </script>
    </body>
</html>
